fix(dashboard-api): enforce SameSite=Lax on all cookies to prevent CSRF attacks - #240
Conversation
…RF attacks Changes all dashboard-api cookies from SameSite=None (production) / Lax (development) to SameSite=Lax across all environments. This prevents the browser from sending cookies on cross-origin subresource requests, closing the CSRF attack vector where an external site could trigger authenticated API calls via cookie-bearing requests. Affected cookies: - accessToken (auth session) - refreshToken (auth session) - _csrf (CSRF secret cookie) - dashboardGithubOauthState (GitHub OAuth state) Closes geturbackend#239
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates cookie ChangesSameSite Cookie Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #239 - Dashboard API CSRF vulnerability
Problem
Auth middleware reads JWT from
eq.cookies.accessToken\ as primary source. The cookies were set with \SameSite=None\ in production, allowing browsers to attach them on any cross-origin request.
Solution
Changed all dashboard-api cookies to use \SameSite=Lax\ consistently across all environments. This prevents cookies from being sent on cross-origin subresource requests while still allowing top-level navigations.
Affected cookies:
efreshToken, _csrf, \dashboardGithubOauthState\
Files changed:
Verification
Summary by CodeRabbit